var t = require("../../../utils/api.js"), e = (require("../../../utils/disapi.js"), 
getApp());

Page({
    data: {},
    onLoad: function(a) {
        var o = this;
        t.markrting({
            op: "distribution_recharge_info",
            openid: e.globalData.openid
        }).then(function(t) {
            if (console.log(t), 0 == t.code) {
                for (var e = t.data.data.list, a = 0; a < e.length; a++) e[a].timeformat = o.timeformat(e[a].time, "Y/M/D h:m");
                if (e.length < 10) var i = 0, n = !0; else i = 2;
                o.setData({
                    info: e,
                    infos: t.data.data,
                    page: i,
                    noMore: n
                });
            }
        });
    },
    timeformat: function(t, e) {
        var a = [ "Y", "M", "D", "h", "m", "s" ], o = [], i = parseInt(t), n = new Date(1e3 * i);
        o.push(n.getFullYear()), o.push(n.getMonth() + 1 >= 10 ? n.getMonth() + 1 : "0" + (n.getMonth() + 1)), 
        o.push(n.getDate() >= 10 ? n.getDate() : "0" + n.getDate()), o.push(n.getHours() >= 10 ? n.getHours() : "0" + n.getHours()), 
        o.push(n.getMinutes() >= 10 ? n.getMinutes() : "0" + n.getMinutes()), o.push(n.getSeconds() >= 10 ? n.getSeconds() : "0" + n.getSeconds());
        for (var r in o) e = e.replace(a[r], o[r]);
        return e;
    },
    onReachBottom: function(a) {
        var o = this, i = o.data.info;
        if (0 == o.data.page) return o.setData({
            noMore: !0
        }), !1;
        o.setData({
            showMore: !0
        });
        var n = {
            op: "distribution_recharge_info",
            openid: e.globalData.openid,
            page: o.data.page
        };
        t.markrting(n).then(function(t) {
            if (console.log(t), 0 == t.code) {
                for (var e = t.data.data.list, a = 0; a < e.length; a++) e[a].timeformat = o.timeformat(e[a].time, "Y/M/D h:m"), 
                i.push(e[a]);
                if (e.length < 10) var n = 0, r = !0; else n = o.data.page + 1;
                o.setData({
                    info: i,
                    page: n,
                    noMore: r,
                    showMore: !1
                });
            }
        });
    }
});